import 'package:flutter/material.dart';

class Sliver01 extends StatefulWidget {
  const Sliver01({Key key}) : super(key: key);

  @override
  _Sliver01State createState() => _Sliver01State();
}

class _Sliver01State extends State<Sliver01>
    with SingleTickerProviderStateMixin {
  AnimationController _controller;

  @override
  void initState() {
    super.initState();
    _controller = AnimationController(vsync: this);
  }

  @override
  void dispose() {
    super.dispose();
    _controller.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(title: Text('Sliver01')),
        body: CustomScrollView(
          slivers: [
            SliverList(
              delegate: SliverChildBuilderDelegate((context, index) {
                return Container(
                  height: 30,
                  color: Colors.primaries[index % 18],
                );
              }, childCount: 30),
            ),
            SliverGrid(
                delegate: SliverChildBuilderDelegate((context, index) {
                  return Container(
                    height: 30,
                    color: Colors.primaries[index % 18],
                  );
                }),
                gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
                    crossAxisCount: 4))
          ],
        ));
  }
}

Widget sliver01() {
  return CustomScrollView(
    slivers: [
      SliverToBoxAdapter(
        child: FlutterLogo(
          size: 100,
        ),
      ),
      SliverGrid(
        delegate: SliverChildBuilderDelegate((c0ntext, index) {
          return Container(
            height: 200,
            color: Colors.primaries[index % 18],
          );
        }, childCount: 27),
        gridDelegate:
            SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 5),
      ),
      SliverList(
        delegate: SliverChildBuilderDelegate((context, index) {
          return Container(
            height: 200,
            color: Colors.primaries[index % 18],
          );
        }),
      )
    ],
  );
}

Widget listview() {
  return ListView.builder(
    itemBuilder: (BuildContext context, int index) {
      return Container(height: 200, color: Colors.primaries[index % 18]);
    },
  );
}
